<?php 
class LoginController extends AppController{
	var $name = "Users";
	/***
	**Phần giành cho admin
	***/
	function admin_index() {
		if (!empty($_POST)) {
			$username = $_POST['username'];
			$password = $_POST['password'];
			$checkuser = $this->User->find('all',array('conditions'=>array('username'=>$username,'password'=>$password),'limit'=>1));
			print_r($checkuser);
			if(isset($checkuser)){
				$this->Session->write('auth',$checkuser);
				$this->Session->write('controller',$checkuser[0]['User']['controller']);
				$this->Session->write('admin_name',$checkuser[0]['User']['username']);
				print_r($this->Session->read("admin_name"));
				//$this->redirect(array('controller'=>'dashboard','action'=>'admin_index'));
			}
			
		}
		//$this->render('/admin');
	}
	function admin_logout() {
		echo "admin_logout----------------";
		die;
		$this->Session->destroy();
		$this->Session->delete('auth');
		$this->render('/admin');
	}
}
?>
